<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>filter</title>
  <script src="/vue.js"></script>
</head>
<body>
  <div id="root">
    性别：{{gender | g('人') | p}}
  </div>
  <script>
    var vm = new Vue({
      el: '#root',
      data: {
        gender: 1
      },
      filters: {
        g(value, str) {
          let r = value === 1 ? '女' : '男'
          return r + str
        },
        p(value) {
          return '大'+value
        }
      },
      computed: {
        // g() {
        //   return this.gender === 1 ? '女' : '男'
        // }
      },
    })
  </script>
</body>
</html>